﻿<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>SPC检测项维护</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <link rel="stylesheet" href="/InSiteWebApplication/Content/webuploader/webuploader.css" />
    <style>
        .easyui-linkbutton
        {
            margin-left: 20px;
        }
        table tr td
        {
            padding: 0px 5px;
        }
        #ApsPoolForm
        {
            padding: 10px 0px;
        }
        .priority
        {
            margin: 0 10px;
        }
        .fontRight
        {
            text-align: right;
            padding: 5px 0;
            display: grid;
        }
    </style>
</head>
<body>
    <div class="panelSection">
        <div class="easyui-panel " title="编辑区域" style="padding: 3px;width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
            <form id="SpcForm">
            <table class="tabel" cellpadding="5">
                <tr class="divLabel">
                    <td>
                        工序名称
                    </td>
                    <td>
                        工步名称
                    </td>
                    <td>
                        基准值
                    </td>
                    <td>
                        上公差
                    </td>
                    <td>
                        下公差
                    </td>
                </tr>
                <tr>
                    <td>
                        <input class="easyui-textbox" type="text" name="WORKFLOWSTEPNAME" style="width: 150px;
                            height: 22px" data-options="editable:false" readonly />
                    </td>
                    <td>
                        <input class="easyui-textbox" type="text" name="STEPINFONAME" style="width: 150px;
                            height: 22px" data-options="editable:false" readonly />
                    </td>
                    <td>
                        <input class="easyui-numberbox" type="text" name="BASEVALUE" style="width: 150px;
                            height: 22px" data-options="precision:2" required="required" />
                    </td>
                    <td>
                        <input class="easyui-numberbox" type="text" name="FLOORFLOAT" style="width: 150px;
                            height: 22px" data-options="precision:2" required="required" />
                    </td>
                    <td>
                        <input class="easyui-numberbox" type="text" name="CEILFLOAT" style="width: 150px;
                            height: 22px" data-options="precision:2" required="required" />
                    </td>
                </tr>
                <tr class="divLabel">
                    <td>
                        SPC检测类型
                    </td>
                    <td>
                        SPC判异规则
                    </td>
                    <td>
                        是否SPC
                    </td>
                </tr>
                <tr>
                    <td>
                        <input class="easyui-combobox SPCTYPE" type="text" name="SPCTYPE" style="width: 150px;
                            height: 22px" />
                    </td>
                    <td>
                        <input class="easyui-combogrid SPCRULE" type="text" name="SPCRULE" style="width: 150px;
                            height: 22px" required="required" />
                    </td>
                    <td>
                        <input class="easyui-combobox ISSPC" type="text" name="ISSPC" style="width: 150px;
                            height: 22px" required="required" />
                    </td>
                </tr>
            </table>
            </form>
        </div>
    </div>
    <div class="panelSection">
        <div class="easyui-panel " title="按钮区域" style="padding: 3px;width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
            <a href="javascript:void(0)" onclick="page.SaveSpc()" class="easyui-linkbutton" data-options="width:120"
                style="margin: 10px 0 10px 20px;">保存</a> <a href="javascript:void(0)" onclick="page.Close()"
                    class="easyui-linkbutton" data-options="width:120" style="margin: 10px 0 10px 20px;">
                    关闭</a>
        </div>
    </div>
    <!--信息提示区域-->
    <div id="statusMessage" style="font-size: 14px; height: 40px">
    </div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/array.pollyfill.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script type="text/javascript">
    //创建人：longb
    //日期：2023-02-22
    //描述：SPC检测项维护
    var page = {
        StepCheckStepID: getParam("id"), //工序ID
        rootPath: getRootPath(), //网站根路径
        ajaxUrl: getRootPath() + "/Ashx/StepCheckPointResultSPCHandler.ashx",
        init:function(){
            $('.SPCTYPE').combobox({
                data:[{id:1,text:'计数型'},{id:2,text:'计量型'}],
                valueField:'id',
                textField:'text',
                value:1,
                panelHeight:100
            });
            $('.SPCRULE').combogrid({
                multiple : true,
                panelWidth:550,
                panelHeight:160,
                value:'R0',
                idField:'id',
                textField:'id',
                data:[{id:'R0',text:'超出规格限制',desc:'1个点超出上下限值（计数型）或与目标值不同（计量型），一个数据'},
                    {id:'R1',text:'连续9个点落在中心线同一侧',desc:'连续9个点落在目标值(5+（0.5+(-0.1)）/2)的同一侧（上或下）'},
                    {id:'R2',text:'连续6个点递增或递减',desc:'连续6个点递增或递减'},
                    {id:'R3',text:'连续14点中相临点交替上下',desc:'连续14个点交替上下'}],
                columns: [[
                    {field:'id',title:'编号',width:40,align:'center'},
                    {field:'text',title:'规则描述',width:150},
                    {field:'desc',title:'计算规则说明',width:250}
                ]],
                fitColumns: true
            });
             $('.ISSPC').combobox({
                data:[{id:0,text:'否'},{id:1,text:'是'}],
                valueField:'id',
                textField:'text',
                value:1,
                panelHeight:100
            });
            page.post({action:'GetStepCheckInfoData',StepCheckInfo:page.StepCheckStepID}, true, function (res) {
                if(res.length>0){
                    $('#SpcForm').form('load',res[0]);
                    }
            });
        },
        SaveSpc: function () {
            var isValid = $("#SpcForm").form('validate');
            if (!isValid) {
                displayMessage("请填写必填项", false);
                return false;
            }
            var frdata = $('#SpcForm').serializeArray();
            var data = {};
            $.each(frdata, function () {
                data[this.name] = this.value
            });
            data.SPCRULE = $('.SPCRULE').combogrid("getText");
            data.STEPCHECKPOINTID=page.StepCheckStepID;
            var param = {
                action: "SaveStepCheckPointSpcData",
                data: JSON.stringify(data),
            };
            page.post(param, true, function (res) {
                if (res.Result) {
                     self.close();
                     window.returnValue='1';
                }
                else {
                    displayMessage(res.Message, res.Result);
                }
            });
        },
        Close: function () {
            self.close();
            window.returnValue='2';
        },
        //post数据
        post: function (param, async, callback) {
            $.ajax({
                type: "Post",
                url: page.ajaxUrl,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                }
            });
        }
    };
    $(function () {
        page.init();
    });
</script>
